<template>
  <div class="goods" style="min-height:100vh;">
    <!-- <div class="topBar">
      <van-icon class="i_left" name="arrow-left" @click="$router.back()" />
      <span>登录</span>
    </div> -->
    <img class="slogan" src="../../assets/slogan.png" />
    <div class="formOuter">
      <div class="formTit"><span>您好，欢迎登录</span></div>
      <div class="formBox">
        <div class="formCol">
          <i class="colIcon i_user"></i>
          <input
            v-model="info.mobile"
            type="text"
            class="inputInner"
            placeholder="请输入账号"
          />
        </div>
        <div class="formCol">
          <i class="colIcon i_pw"></i>
          <input
            class="inputInner"
            v-model="info.password"
            type="password"
            placeholder="请输入密码"
          />
        </div>
        <a href="javascript:;" class="confirmBtn" @click="login">提交</a>
      </div>
      <!-- <div class="q_link">
        <a @click="$router.push({path: '/register'})">输入财富码注册</a>
        <a @click="$router.push({path: '/forgetPsw'})">忘记密码</a>
      </div> -->
    </div>
  </div>
</template>

<script>

export default {
  data () {
    return {
      pathUrl: '',
      info: { phone: '' },
      value: '',
      columns: ['+86', '+852', '+853', '+886'],
      showPicker: false,
    };
  },
  beforeRouteEnter(to, from, next) {
    next(vm => {    
      vm.pathUrl = from.fullPath
    })
  },
  mounted() {
    document.body.scrollTop = 0
    document.documentElement.scrollTop = 0
  },
  methods: {
    login () {
      if (!this.info.mobile) {
        this.alert('请输入账号');return;
      }
      if (!this.info.password) {
        this.alert('请输入密码');return;
      }
      this.sendReq('/api/user/login', 'post', this.info, r => {
        localStorage.setItem('token', r.token)
        this.$router.push({path: '/'})
      })
    },
  }
};
</script>

<style lang="less" scoped>
.goods {
  padding: 50px 15px 50px 15px;
  background: url(../../assets/bg.png) no-repeat center bottom;
  background-size: 100% 100%; 
  box-sizing: border-box; 
}
.slogan{
  display: block;
  margin:0 auto 12vw auto;
  width:70vw;
}
.formOuter{
  width:80vw;
  margin:0 auto;
  background: linear-gradient(180deg, #3c9dff4d 0%, #09429ce6 100%);
  padding:30px;
  box-sizing: border-box;
    .formTit {
      font-size: 18px;
      color: #fff;
      text-align: center;
    }
}
.formInfo {
  font-size: 12px;
  font-weight: 500;
  color: #999999;
}
.formBox {
  margin: 0 auto;
  padding: 10px 0;
  width:100%;
  .formCol {
    width: 100%;
    height: 38px;
    border:1px solid #2B89E7;
    margin: 15px 0;
    position: relative;
    // background: rgba(43, 137, 231, 0.1);
    .inputInner {
      position: absolute;
      width: 100%;
      height: 100%;
      background-color: rgba(43, 137, 231, 0.1)!important;
      top: 0;
      left: 0;
      border: none;
      outline: none;
      font-size: 14px;
      padding: 0 42px;
      box-sizing: border-box;
      color:#fff;
    }
    .inputInner::placeholder {
      color:rgba(255,255,255,0.5);
    }
    .colIcon,
    .colline,
    .i_eyes {
      display: block;
      position: absolute;
    }
    .colIcon {
      width: 16px;
      height: 16px;
      top: 50%;
      margin-top: -8px;
      left: 2px;
      border-right:1px solid #588ABC;
      padding-left:15px;
    }
    .i_pw {
      background: url(../../assets/i_pw.png) no-repeat center center;
      background-size: 100% 100%;
      background-size: 16px 16px;
    }
    .i_user {
      background: url(../../assets/i_user.png) no-repeat center center;
      background-size: 100% 100%;
      background-size: 16px 16px;
    }
  }
  .forgetPsw {
    display: block;
    width: 100%;
    text-decoration: none;
    text-align: right;
    font-size: 15px;
    font-weight: 500;
    color: #ff3c3c;
  }
  .confirmBtn {
    display: block;
    width: 100%;
    height: 40px;
    background: #0174DA;
    text-align: center;
    line-height: 40px;
    font-size: 15px;
    font-weight: 500;
    color: #fff;
    margin-top: 30px;
  }
}
.q_link {
  display: flex;
  justify-content: space-between;
  padding: 15px 0;
  margin: 0 auto;
  padding: 10px 0 0 0;
  width: 300px;  
  a:first-child{color: #FF791C;}
  a {
    font-size: 13px;
    font-weight: 400;
    color: #999999;
    line-height: 26px;
    text-decoration: none;
  }
}
</style>
